import java.util.Arrays;

public class Solution {
    public static int missingNumber(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != i)
                return i;
            else
                return i+1;
        }
        return 1;
    }
    
    public static void main(String[] args) {
        int[] nmus = new int[]{3,0,1};
        missingNumber(nmus);
    }
}